﻿using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
//
using System.IO;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string str = string.Empty;
        string path1 = "c:\\temp\\blog.txt";
        //前面加@表示强制格式【不用转义】等。。
        string path2 = @"c:\temp\blog";
        string path3 = @"Record";
        //扩展名、文件所在目录
        if (Path.HasExtension(path1))
        {
            str = string.Format("路径{0}下有一扩展名为{1}的文件，属于目录{2}", path1, Path.GetExtension(path1), Path.GetDirectoryName(path1));
            Response.Write(str);
        }
        //路径根目录
        if (Path.IsPathRooted(path2))
        {
            str = string.Format("路径{0}的根目录为{1}", path2, Path.GetPathRoot(path2));
            Response.Write("<br/>" + str);
        }
        //相对路径的完整路径
        str = string.Format("路径{0}的全路径为{1}", path3, Path.GetFullPath(path3));
        Response.Write("<br/>" + str);

    }
}
